home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / sendmail-5.65c+IDA-1.4.4.1 / uiuc / phquery.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-11  |  6.4 KB  |  209 lines

  1. /*
  2.  * @(#)$Header: /usr/local/src/mail/sendmail/uiuc/RCS/phquery.h,v 1.7 90/12/11 12:26:59 paul Exp $
  3.  */
  4.  
  5. /*
  6.  * Configuration parameters.
  7.  *
  8.  * Defining EXPAND_TO will print the list of expanded addresses on an added
  9.  * X-PH-To: header line.  This will also expand names found in /usr/lib/aliases
  10.  * lists.  Leaving it undefined will cause phquery to print only a version
  11.  * line with the name of the host running phquery, e.g.,
  12.  * X-Ph: V3.5@uxc.cso.uiuc.edu .
  13.  */
  14. /*#define        EXPAND_TO    /* Print translated addresses */
  15.  
  16. /*
  17.  * An address tested as a name is first run through as is.  If no matches
  18.  * are found then any punctuation characters are converted one at a time
  19.  * (leftmost first) to space characters and the lookup is repeated until
  20.  * there are no more punctuation characters.  If WILDNAMES is #define'd,
  21.  * a wildcard char '*' will be appended after each single character name,
  22.  * e.g. p-pomes is tried as "p* pomes".  This has risks as follows:  assume
  23.  * Duncan Lawrie sets his alias to "lawrie".  A query for d-lawrie will
  24.  * fail as a alias lookup but succeed as a name lookup when written as
  25.  * "d* lawrie".  This works until Joe Student sets his alias to "d-lawrie".
  26.  * Whoops.  Still in a non-hostile environment, this function may be more
  27.  * useful than dangerous.
  28.  */
  29. /*#define        WILDNAMES    /* Append '*' to single char names */
  30.  
  31. /* End of configurable parameters. */
  32.  
  33. /*
  34. ** Reply codes:
  35. **    1XX - status
  36. **    2XX - information
  37. **    3XX - additional information or action needed
  38. **    4XX - temporary errors
  39. **    5XX - permanent errors
  40. **    6XX - phquery specific codes
  41. */
  42. #define LR_PROGRESS    100    /* in progress */
  43. #define LR_ECHO        101    /* echoing cmd */
  44.  
  45. #define LR_OK        200    /* success */
  46. #define LR_RONLY    201    /* database ready in read only mode */
  47.  
  48. #define LR_MORE        300    /* need more info */
  49. #define LR_LOGIN    301    /* encrypt this string */
  50.  
  51. #define LR_TEMP        400    /* temporary error */
  52. #define LR_INTERNAL    401    /* database error, possibly temporary */
  53. #define LR_LOCK        402    /* lock not obtained within timeout period */
  54. #define LR_DOWN        475    /* database unavailable; try again later */
  55.  
  56. #define LR_ERROR    500    /* hard error; general */
  57. #define    LR_NOMATCH    501    /* no matches to query */
  58. #define LR_TOOMANY    502    /* too many matches to query */
  59. #define LR_AINFO    503    /* may not see that field */
  60. #define LR_ASEARCH    504    /* may not search on that field */
  61. #define LR_ACHANGE    505    /* may not change field */
  62. #define LR_NOTLOG    506    /* must be logged in */
  63. #define LR_FIELD    507    /* field unknown */
  64. #define LR_ABSENT    508    /* field not present in entry */
  65. #define LR_ALIAS    509    /* requested alias is already in use */
  66. #define LR_AENTRY    510    /* may not change entry */
  67. #define LR_ADD        511    /* may not add entries */
  68. #define LR_VALUE    512    /* illegal value */
  69. #define LR_OPTION    513    /* unknown option */
  70. #define LR_UNKNOWN    514    /* unknown command */
  71. #define LR_NOKEY    515    /* no indexed field found in query */
  72. #define LR_AUTH        516    /* no authorization for query */
  73. #define LR_READONLY    517    /* operation failed; database is read-only */
  74. #define LR_LIMIT    518    /* too many entries selected for change */
  75. #define LR_HISTORY    519    /* history substitution failed */
  76.  
  77. #define LR_SYNTAX    599    /* syntax error */
  78.  
  79. #define LR_AMBIGUOUS    600    /* ambiguous or multiple match */
  80.  
  81. #define        NONE_OF_ABOVE        -1
  82.  
  83. struct ReplyCodes {
  84.     int    key;
  85.     char    *value;
  86. } Codes[] = {
  87.     LR_PROGRESS,    "Nameserver search in progress",
  88.     LR_ECHO,    "Echoing nameserver cmd",
  89.     LR_OK,        "Success",
  90.     LR_RONLY,    "Nameserver database ready in read only mode",
  91.     LR_MORE,    "More info needed to process nameserver query",
  92.     LR_LOGIN,    "Encrypt this string",
  93.     LR_TEMP,    "Temporary nameserver error",
  94.     LR_INTERNAL,    "Nameserver database error, possibly temporary",
  95.     LR_LOCK,    "Nameserver lock not obtained within timeout period",
  96.     LR_ERROR,    "Nameserver hard error; general",
  97.     LR_NOMATCH,    "No matches to nameserver query",
  98.     LR_TOOMANY,    "Too many matches found to nameserver query",
  99.     LR_AINFO,    "May not see that nameserver field",
  100.     LR_ASEARCH,    "May not search on that nameserver field",
  101.     LR_ACHANGE,    "May not change that nameserver field",
  102.     LR_NOTLOG,    "Must be logged in to nameserver",
  103.     LR_FIELD,    "Unknown nameserver field",
  104.     LR_ABSENT,    "E-mail field not present in nameserver entry",
  105.     LR_ALIAS,    "Requested nameserver alias is already in use",
  106.     LR_AENTRY,    "May not change nameserver entry",
  107.     LR_ADD,        "May not add nameserver entries",
  108.     LR_VALUE,    "Illegal value",
  109.     LR_OPTION,    "Unknown nameserver option",
  110.     LR_UNKNOWN,    "Unknown nameserver command",
  111.     LR_NOKEY,    "No indexed field found in nameserver query",
  112.     LR_AUTH,    "No authorization for nameserver request",
  113.     LR_READONLY,    "Nameserver operation failed; database is read-only",
  114.     LR_LIMIT,    "Too many nameserver entries selected for change",
  115.     LR_HISTORY,    "History substitution failed",
  116.     LR_SYNTAX,    "Syntax error",
  117.     LR_AMBIGUOUS,    "Multiple matches found for nameserver query",
  118.     NONE_OF_ABOVE,    (char *)NULL
  119. };
  120.  
  121. /*
  122.  * Field types returned by QI.  These must be sorted in lexographic order.
  123.  */
  124. #define        ADDRESS            0
  125. #define        ALIAS            1
  126. #define        ALL            2
  127. #define        BIRTHDAY        3
  128. #define        CALLSIGN        4
  129. #define        CLASSCO            5
  130. #define        CURRICULUM        6
  131. #define        DEF_ACCOUNT        7
  132. #define        DEPARTMENT        8
  133. #define        EMAIL            9
  134. #define        FAMILY            10
  135. #define        HERO            11
  136. #define        HOME_ADDRESS        12
  137. #define        HOURS            13
  138. #define        ID            14
  139. #define        MAILCODE        15
  140. #define        MAIL_ADDRESS        16
  141. #define        NAME            17
  142. #define        NICKNAME        18
  143. #define        OFFICE_ADDRESS        19
  144. #define        OTHER            20
  145. #define        PAGER            21
  146. #define        PASSWORD        22
  147. #define        PERMANENT_ADDRESS    23
  148. #define        PHONE            24
  149. #define        PROJECT            25
  150. #define        PROXY            26
  151. #define        REVISIONS        27
  152. #define        SOUND            28
  153. #define        TITLE            29
  154. #define        TYPE            30
  155.  
  156. struct    QI_fields {
  157.     int    key;
  158.     char    *value;
  159. } Fields[] = {
  160.     ADDRESS,    "address",
  161.     ALIAS,        "alias",
  162.     ALL,        "all",
  163.     BIRTHDAY,    "birthday",
  164.     CALLSIGN,    "callsign",
  165.     CLASSCO,    "classco",
  166.     CURRICULUM,    "curriculum",
  167.     DEF_ACCOUNT,    "def_account",
  168.     DEPARTMENT,    "department",
  169.     EMAIL,        "email",
  170.     FAMILY,        "family",
  171.     HERO,        "hero",
  172.     HOME_ADDRESS,    "home_address",
  173.     HOURS,        "hours",
  174.     ID,        "id",
  175.     MAIL_ADDRESS,    "mail_address",
  176.     MAILCODE,    "mailcode",
  177.     NAME,        "name",
  178.     NICKNAME,    "nickname",
  179.     OFFICE_ADDRESS,    "office_address",
  180.     OTHER,        "other",
  181.     PAGER,        "pager",
  182.     PASSWORD,    "password",
  183.     PERMANENT_ADDRESS,    "permanent_address",
  184.     PHONE,        "phone",
  185.     PROJECT,    "project",
  186.     PROXY,        "proxy",
  187.     REVISIONS,    "revisions",
  188.     SOUND,        "sound",
  189.     TITLE,        "title",
  190.     TYPE,        "type",
  191.     NONE_OF_ABOVE,    (char *)NULL
  192. };
  193.  
  194. struct    QI_response {
  195.     int    code;
  196.     int    subcode;
  197.     int    field;
  198.     char    *message;
  199. };
  200. typedef struct QI_response QIR;
  201.  
  202. struct    NewAddress {
  203.     char    *original;
  204.     char    *new;
  205.     int    code;
  206.     QIR    *QIalt;
  207. };
  208. typedef    struct NewAddress NADD;
  209.